package com.houtaipeingboot.service.impl;

import com.houtaipeingboot.mapper.DepartmentDao;
import com.houtaipeingboot.pojo.Department;
import com.houtaipeingboot.service.DepartmentService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class DepartmentServiceImpl implements DepartmentService {
    @Autowired
    private DepartmentDao dd;
    @Override
    public List<Department> getDepartsByDepName(String deparname) {
        List<Department> list = dd.getDepartsByDepName(deparname);
        return list;
    }

    @Override
    public boolean delByDid(int did) {
        int i = dd.delByDid(did);
        if(i>0){
            return true;
        }else {
            return false;
        }


    }

    @Override
    public boolean inByDid( @Param("depart") String depart, @Param("departmentdescription") String departmentdescription) {
        int i = dd.inByDid(depart,departmentdescription);
        if(i>0){
            return true;
        }else {
            return false;
        }
    }

    @Override
    public boolean upByDid(int did, String depart, String departmentdescription) {
        int i = dd.upByDid(did,depart,departmentdescription);
        if(i>0){
            return true;
        }else {
            return false;
        }
    }
}
